const express = require("express");
const errorHandler = require("./middlewares/errorHandler");
require("./model");

const app = express();

app.use(express.json());

const host =
  process.env.NODE_ENV === "production" ? "117.50.23.240" : "localhost";

const router = require("./router");

// 挂载路由
app.use(router);

app.use(errorHandler);

app.listen(9000, host, () => {
  console.log(`server is running at ${host}:9000`);
});
